---
title: "Balancing algorithm report"
output:
  html_document:
    df_print: paged
editor_options:
  chunk_output_type: console
---

```{r,message=FALSE,echo=FALSE}
library(dplyr)
```

```{r,echo=FALSE}
# Supply a "MyData.csv" to the directory,
# where column 1 of csv is the ID
clean <- read.csv("spain_clean.csv")
MyData=clean
MyData=select(MyData,Record.ID,joint,pol,sex,vot)
write.csv(MyData,"MyData.csv",row.names = F)
MyData <- read.csv("MyData.csv")
```

# Python (config = code) 
```{python engine.path="/usr/bin/python3.5",results='hide'}
import sys
sys.path.append('/home/shared/data/balancing/')
import inject_v2
config = "{1: {'degreeHigh':9,'noDegreeHigh':41,'degreeLow':22.7,'noDegreeLow':27.3}},{2: {'interest':48.1,'LowInterest':51.9}},{3: {'Male':49.8,'Female':50.2}},{4: {'PP':23.64,'PSOE':20.85,'IP':9.09,'Podemos':7.23,'UPyD':5.90,'CEU':4.91,'EPDD':3.63,'Cs':2.87,'LPD':1.88,'Undec':20.00}}"

filename = '/home/fernando/Misc/bjpolFinal/Spain/MyData.csv'

inject_v2.run(config, filename, "/home/fernando/Misc/bjpolFinal/Spain/myBal", 2, 0, 0)
```

